ac.buff("隐身") {

    cover_type = 1,
    cover_max = 1,
    
    remove_when_attack = false,
    remove_when_spell = false,

    on_add = function(self)

		self.owner:add_restriction '隐身'


		if self.remove_when_attack then
			self.trg_attack = self.owner:event '单位-攻击' (function()
				self:remove()
			end)
		end
		if self.remove_when_spell then
			self.trg_spell = self.owner:event '单位-开始释放技能' (function()
				self:remove()
			end)
		end
		if self.remove_when_spell then
			self.trg_spell = self.owner:event '单位-使用物品' (function()
				self:remove()
			end)
		end
	end,

	on_remove = function(self)
		self.owner:remove_restriction '隐身'
		if self.trg_attack then
			self.trg_attack:remove()
		end
		if self.trg_spell then
			self.trg_spell:remove()
		end
	end,
	
	on_cover = function(self, dest)
		--更改原来buff的持续时间
		if dest.time > self:get_remaining() then
			self:set_remaining(dest.time)
		end
		return false
	end,
}